﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<ComeSeeThis_MVC2.Models.PaginatedList<ComeSeeThis_MVC2.Models.Motor>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Motors
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
          <% Html.RenderPartial("SubMenu"); %>
  <h2>
        Motors</h2>
    <table width="1000px">
        <tr>
            <th>
                Company
            </th>
            <th>
                Motor Name
            </th>
            <th>
                Part Number
            </th>
            <th>
                Size
            </th>
            <th>
                Turns
            </th>
            <th>
                KiloVolt
            </th>
            <th>
                Magnet Type
            </th>
            <th>
                Magnet Size
            </th>
            <th>
                Watts
            </th>
            <th>
                Sensored
            </th>
            <th>
                Approved
            </th>
        </tr>
        <% foreach (var item in Model)
           { %>
        <tr>
            <td>
                <%: item.Company.CompanyName %>
            </td>
            <td>
                <%: Html.ActionLink(item.MotorName, "Details", new { id=item.MotorId })%>
            </td>
            <td>
                <%: item.PartNumber %>
            </td>
            <td>
                <%: item.MotorSize.MotorSizeName %>
            </td>
            <td>
                <%: String.Format("{0:F}", item.Turns) %>
            </td>
            <td>
                <%: item.KiloVolt %>
            </td>
            <td>
                <%: item.MagnetType %>
            </td>
            <td>
                <%: item.MagnetSize %>
            </td>
            <td>
                <%: String.Format("{0:F}", item.Watts) %>
            </td>
            <td>
                <%: item.Sensored %>
            </td>
            <td>
                <%: item.Approved %>
            </td>
        </tr>
        <% } %>
        <tr>
            <td colspan="11">
                <table width="100%">
                    <tr>
                        <td width="50%">
                            <% if (Model.HasPreviousPage)
                               { %>
                            <%: Html.RouteLink("<<<  Previous", "Motors", new { page=(Model.PageIndex-1) }) %>
                            <% } %>
                        </td>
                        <td align="right" width="50%">
                            <% if (Model.HasNextPage)
                               { %>
                            <%: Html.RouteLink("Next  >>>", "Motors", new { page = (Model.PageIndex + 1) })%>
                            <% } %>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    <p>
        <% if (User.IsInRole("SiteAdmin") || User.IsInRole("ContentAdmin"))
           { %>
        <%:Html.ActionLink("Create New", "Create", new { q = Request.Url.ToString() })%>
        <%  } %>
    </p>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeaderContent" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="BodyTagContent" runat="server">
</asp:Content>
